<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
// When the selection to delete ends at the end of a paragraph, that paragraph
// will be completely deleted, but a <br> or an empty block will remain.
// Merging must happen to remove that <br> or prune that block.
//
// This test illustrates a case where merging wasn't allowed to happen just
// because the end of the selection to delete was in a fully selected line,
// which is nonsense.
//
// Fixing that bug exposed a problem with merging. If deletion empties out the
// block that contained the start of the selection to delete, that block can
// collapse away and become impossible to merge into.  So we insert a
// placeholder to prop it open so that the merge can happen.
selection_test(
    [
        '<div contenteditable>',
            '<div style="border: 1px solid red;">^abc</div>',
            '<div style="border: 1px solid blue;">def|<br></div>',
        '</div>',
    ],
    'Delete',
    [
        '<div contenteditable>',
            '<div style="border: 1px solid red;">|<br></div>',
        '</div>',
    ]);
</script>
